<?php

namespace common\models\db\tables;

use Yii;

/**
 * This is the model class for table "{{%product_materials}}".
 *
 * @property int $id
 * @property int $created_at
 * @property int $updated_at
 * @property int $deleted_at
 * @property int $product_id
 * @property int $material_type 1文本2图片3视频4富文本
 * @property string $content 展示内容
 * @property int $material_sort
 * @property int|null $created_by_admin
 * @property int|null $updated_by_admin
 */
class ProductMaterials extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%product_materials}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['created_at', 'updated_at', 'deleted_at', 'product_id', 'material_type', 'content', 'material_sort', 'created_by_admin', 'updated_by_admin'], 'trim'],
            [['created_at', 'updated_at', 'product_id', 'content'], 'required'],
            [['created_at', 'updated_at', 'deleted_at', 'product_id', 'material_type', 'material_sort', 'created_by_admin', 'updated_by_admin'], 'integer'],
            [['content'], 'string'],
            [['deleted_at'], 'default', 'value' => 0],
            [['material_type', 'material_sort'], 'default', 'value' => 1],
            [['created_by_admin', 'updated_by_admin'], 'default', 'value' => null],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
            'deleted_at' => Yii::t('app', 'Deleted At'),
            'product_id' => Yii::t('app', 'Product ID'),
            'material_type' => Yii::t('app', '1文本2图片3视频4富文本'),
            'content' => Yii::t('app', '展示内容'),
            'material_sort' => Yii::t('app', 'Material Sort'),
            'created_by_admin' => Yii::t('app', 'Created By Admin'),
            'updated_by_admin' => Yii::t('app', 'Updated By Admin'),
        ];
    }
}
